package com.ctsi.system.app.rest.request;

import com.ctsi.commons.util.UtilValidate;
import com.ctsi.system.domain.SysMenus;

import java.io.Serializable;

/**
 * @author zhangjw
 * @Date: 2018/7/30 15:10
 * @Description:
 */
public class InsertMenuRequest implements Serializable {

    private static final long serialVersionUID = 43526968226681010L;
    private Long id;
    /**
     * 标题
     */
    private String label;
    /**
     * URL
     */
    private String href;
    /**
     * icon
     */
    private String icon;
    /**
     * 菜单权限
     */
    private String permissionId;
    /**
     * 菜单权限
     */
    private Integer keepAlive;
    /**
     * 描述
     */
    private String description;
    /**
     * parentId
     */
    private Long parentId;
    /**
     * 菜单类型
     */
    private String menuType;
    /**
     * 顺序号
     */
    private Integer orderNum;

    /**
     * 是否是叶子节点
     */
    private Integer leaf;

    public InsertMenuRequest(){

    }

    public SysMenus toSysMenus(){
        SysMenus menu = new SysMenus();
        menu.setId(this.getId());
        menu.setDescription(this.getDescription());
        menu.setHref(this.getHref());
        menu.setIcon(this.getIcon());
        menu.setKeepAlive(this.getKeepAlive());
        menu.setLabel(this.getLabel());
        menu.setMenuType(UtilValidate.isEmpty(this.getMenuType())? SysMenus.DEFAULT_MENU_TYPE : this.getMenuType());
        menu.setOrderNum(this.getOrderNum());
        menu.setParentId(this.getParentId());
        menu.setPermissionId(this.getPermissionId());
        return menu;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getHref() {
        return href;
    }

    public void setHref(String href) {
        this.href = href;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getPermissionId() {
        return permissionId;
    }

    public void setPermissionId(String permissionId) {
        this.permissionId = permissionId;
    }

    public Integer getKeepAlive() {
        return keepAlive;
    }

    public void setKeepAlive(Integer keepAlive) {
        this.keepAlive = keepAlive;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public String getMenuType() {
        return menuType;
    }

    public void setMenuType(String menuType) {
        this.menuType = menuType;
    }

    public Integer getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(Integer orderNum) {
        this.orderNum = orderNum;
    }

    public Integer getLeaf() {
        return leaf;
    }

    public void setLeaf(Integer leaf) {
        this.leaf = leaf;
    }


    @Override
    public String toString() {
        return "InsertMenuRequest{" +
                "id=" + id +
                ", label='" + label + '\'' +
                ", href='" + href + '\'' +
                ", icon='" + icon + '\'' +
                ", permissionId='" + permissionId + '\'' +
                ", keepAlive=" + keepAlive +
                ", description='" + description + '\'' +
                ", parentId=" + parentId +
                ", menuType='" + menuType + '\'' +
                ", orderNum=" + orderNum +
                ", leaf=" + leaf +
                '}';
    }
}
